Skip to main content

Discord Integration

CocoAntiVPN can send real-time VPN detection alerts to your Discord server using webhooks.

Setting Up Discord Webhook

Step 1: Create a Webhook

  1. Open your Discord server
  2. Go to the channel where you want alerts
  3. Click the gear icon (Edit Channel)
  4. Select Integrations
  5. Click Create Webhook

Step 2: Configure the Webhook

  1. Give your webhook a name (e.g., "CocoAntiVPN Alerts")
  2. Optionally upload an avatar
  3. Click Copy Webhook URL

Step 3: Add to Config

Paste the webhook URL in your config.yml:

discord-webhook-url: "https://discord.com/api/webhooks/1234567890/abcdefghijklmnop..."

Step 4: Reload

/antivpn reload

Alert Information

When a VPN user is detected, CocoAntiVPN sends a Discord notification with:

  • Player name
  • IP address
  • Detection timestamp
  • Server/Proxy name

Best Practices

Dedicated Channel

Create a dedicated channel for VPN alerts:

  1. Create channel #vpn-alerts
  2. Set permissions so only staff can view
  3. Create webhook in this channel

Rate Limiting

Discord has rate limits for webhooks. If you're under a bot attack:

  • Alerts may be delayed
  • Some alerts may be dropped
  • This is normal Discord behavior

The plugin handles rate limits gracefully.

Security

Keep Your Webhook Private

Never share your webhook URL publicly. Anyone with the URL can send messages to your channel.

If your webhook is compromised:

  1. Go to channel settings
  2. Delete the compromised webhook
  3. Create a new webhook
  4. Update your config

Disabling Discord Alerts

To disable Discord integration, leave the URL empty:

discord-webhook-url: ""

Troubleshooting

Alerts Not Appearing

  1. Check URL: Ensure the full webhook URL is in config
  2. Check Channel: Verify webhook is in the correct channel
  3. Check Permissions: Bot must have "Send Messages" in channel
  4. Check Console: Look for webhook errors

Delayed Alerts

Discord webhook rate limits:

  • 30 requests per minute per webhook
  • During attacks, some alerts queue up

"Invalid Webhook" Errors

The webhook may have been deleted. Create a new one and update config.


Alternative: Staff Notifications

If you prefer in-game notifications over Discord:

  1. Leave discord-webhook-url empty
  2. Grant staff the antivpn.notify permission
  3. Staff will receive in-game messages:
[CocoVPN] Steve is using a VPN! (IP: 192.168.1.100)

You can use both simultaneously for comprehensive monitoring.